package ch.zbw.timeline.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import lombok.Data;

/**
 * Domain class for a holiday
 */
@Entity
@SequenceGenerator(name = "id_holiday", initialValue = 1, allocationSize = 1)
@Table(name = "holiday")
@Data
public class Holiday implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_holiday", nullable = false)
	private int id;

	@Column(name = "fk_year_config", nullable = false)
	private int yearConfigFk;

	@Column(name = "fk_holiday_formula", nullable = false)
	private int holidayFormulaFk;

	@Transient
	private HolidayFormula formula;

	@Transient
	private Calendar dateOfHoliday;

	@Transient
	private boolean active = false;

	public Holiday() {
	}

	public Holiday(int yearConfigFk, int holidayFormulaFk) {
		this.yearConfigFk = yearConfigFk;
		this.holidayFormulaFk = holidayFormulaFk;
	}

}
